﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using LibHuman;


namespace Human
{
	public class frmbc_luong_BC : System.Windows.Forms.Form
    {   
        #region 
        AccessData mDB = new AccessData();
        Language lan = new Language();
        DataSet dsHd,ds,dmbc;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox txtnam;
		private System.Windows.Forms.Button btn_xem;
        private System.Windows.Forms.Button btnketthuc;
        private string thang = "", nam = "", msg = "",ReportName = "", _title = "",s_mmyy="";
		private System.Windows.Forms.TextBox txtthang;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.ToolTip toolTip1;
		private System.Windows.Forms.ComboBox combodvi;
		private System.Windows.Forms.Button btnsua;
        private ComboBox cboLoainv;
        private Label label3;
        private GroupBox groupBox1;
        private Panel panelbottom;
        private Panel paneltop;
        private DataGridView dgrhienthi;
        private Label label7;
        private Label label6;
        private TextBox txthoten;
        private Button btnluu;
        private TextBox txtghichu;
        private TextBox txtsonv;
        private TextBox txtmanv;
        private Label label8;
        private DataGridViewTextBoxColumn Colhoten;
        private DataGridViewTextBoxColumn Coltenbp;
        private DataGridViewTextBoxColumn chucvu;
        private DataGridViewTextBoxColumn Colhsluong;
        private DataGridViewTextBoxColumn Colhschucvu;
        private DataGridViewTextBoxColumn hs_kv;
        private DataGridViewTextBoxColumn Colhstnhiem;
        private DataGridViewTextBoxColumn Colhslnhiem;
        private DataGridViewTextBoxColumn Coludnghe;
        private DataGridViewTextBoxColumn Coludtien;
        private DataGridViewTextBoxColumn Colvuotkhung;
        private DataGridViewTextBoxColumn Colt_vkhung;
        private DataGridViewTextBoxColumn Colngayngi;
        private DataGridViewTextBoxColumn Colnstien;
        private DataGridViewTextBoxColumn Coltiencong;
        private DataGridViewTextBoxColumn Colbhxh;
        private DataGridViewTextBoxColumn Colbhyt;
        private DataGridViewTextBoxColumn Colbhtn;
        private DataGridViewTextBoxColumn Colthuclanh;
        private DataGridViewTextBoxColumn Colsotk;
        private DataGridViewTextBoxColumn Colkpcd;
        private DataGridViewTextBoxColumn Colchucvu;
        private DataGridViewTextBoxColumn Colthoigian;
        private DataGridViewTextBoxColumn Coltsan;
        private DataGridViewTextBoxColumn Colom;
        private DataGridViewTextBoxColumn Colghichu;
        private DataGridViewTextBoxColumn Colkl;
        private DataGridViewTextBoxColumn Colkhac;
        private DataGridViewTextBoxColumn Colmangach;
        private DataGridViewTextBoxColumn Colmanv;
        private DataGridViewTextBoxColumn Colmadv;
        private DataGridViewTextBoxColumn Colloaihd;
        private DataGridViewTextBoxColumn Colmltt;
        private DataGridViewTextBoxColumn chucdanhvt;
        private DataGridViewTextBoxColumn Colthang;
        private DataGridViewTextBoxColumn Colnam;
        private CheckBox chk_sudungdlcc;
		private System.ComponentModel.IContainer components;
        #endregion

		public frmbc_luong_BC()
		{			
			InitializeComponent();
            lan.Read_Language_to_Xml(this.Name.ToString(), this);
            lan.Changelanguage_to_English(this.Name.ToString(), this);
		}
		
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmbc_luong_BC));
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.txtnam = new System.Windows.Forms.TextBox();
            this.btnketthuc = new System.Windows.Forms.Button();
            this.btn_xem = new System.Windows.Forms.Button();
            this.txtthang = new System.Windows.Forms.TextBox();
            this.label5 = new System.Windows.Forms.Label();
            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
            this.btnsua = new System.Windows.Forms.Button();
            this.combodvi = new System.Windows.Forms.ComboBox();
            this.cboLoainv = new System.Windows.Forms.ComboBox();
            this.label3 = new System.Windows.Forms.Label();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.dgrhienthi = new System.Windows.Forms.DataGridView();
            this.Colhoten = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Coltenbp = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.chucvu = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colhsluong = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colhschucvu = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.hs_kv = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colhstnhiem = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colhslnhiem = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Coludnghe = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Coludtien = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colvuotkhung = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colt_vkhung = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colngayngi = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colnstien = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Coltiencong = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colbhxh = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colbhyt = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colbhtn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colthuclanh = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colsotk = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colkpcd = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colchucvu = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colthoigian = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Coltsan = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colom = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colghichu = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colkl = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colkhac = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colmangach = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colmanv = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colmadv = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colloaihd = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colmltt = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.chucdanhvt = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colthang = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colnam = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.panelbottom = new System.Windows.Forms.Panel();
            this.txtmanv = new System.Windows.Forms.TextBox();
            this.txtsonv = new System.Windows.Forms.TextBox();
            this.label7 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.txtghichu = new System.Windows.Forms.TextBox();
            this.txthoten = new System.Windows.Forms.TextBox();
            this.btnluu = new System.Windows.Forms.Button();
            this.paneltop = new System.Windows.Forms.Panel();
            this.chk_sudungdlcc = new System.Windows.Forms.CheckBox();
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgrhienthi)).BeginInit();
            this.panelbottom.SuspendLayout();
            this.paneltop.SuspendLayout();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.ForeColor = System.Drawing.Color.Navy;
            this.label1.Location = new System.Drawing.Point(3, 14);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(44, 13);
            this.label1.TabIndex = 26;
            this.label1.Text = "Tháng :";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.Color.Navy;
            this.label2.Location = new System.Drawing.Point(201, 14);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(45, 13);
            this.label2.TabIndex = 27;
            this.label2.Text = "Đơn vị :";
            this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // txtnam
            // 
            this.txtnam.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtnam.ForeColor = System.Drawing.Color.Navy;
            this.txtnam.Location = new System.Drawing.Point(123, 9);
            this.txtnam.MaxLength = 4;
            this.txtnam.Name = "txtnam";
            this.txtnam.Size = new System.Drawing.Size(43, 22);
            this.txtnam.TabIndex = 1;
            this.txtnam.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtnam.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtthang_KeyPress);
            this.txtnam.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtnam_KeyDown);
            // 
            // btnketthuc
            // 
            this.btnketthuc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btnketthuc.ForeColor = System.Drawing.Color.Navy;
            this.btnketthuc.Image = global::Human.Properties.Resources.close_r;
            this.btnketthuc.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnketthuc.Location = new System.Drawing.Point(231, 12);
            this.btnketthuc.Name = "btnketthuc";
            this.btnketthuc.Size = new System.Drawing.Size(60, 28);
            this.btnketthuc.TabIndex = 7;
            this.btnketthuc.Text = " &Thoát";
            this.btnketthuc.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.toolTip1.SetToolTip(this.btnketthuc, "Kết thúc");
            this.btnketthuc.UseVisualStyleBackColor = true;
            this.btnketthuc.Click += new System.EventHandler(this.buttonkethuc_Click);
            // 
            // btn_xem
            // 
            this.btn_xem.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btn_xem.ForeColor = System.Drawing.Color.Navy;
            this.btn_xem.Image = global::Human.Properties.Resources.ok;
            this.btn_xem.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btn_xem.Location = new System.Drawing.Point(42, 12);
            this.btn_xem.Name = "btn_xem";
            this.btn_xem.Size = new System.Drawing.Size(60, 28);
            this.btn_xem.TabIndex = 4;
            this.btn_xem.Text = "  &Xem";
            this.btn_xem.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.toolTip1.SetToolTip(this.btn_xem, "Báo cáo");
            this.btn_xem.UseVisualStyleBackColor = true;
            this.btn_xem.Click += new System.EventHandler(this.xem_Click);
            // 
            // txtthang
            // 
            this.txtthang.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtthang.ForeColor = System.Drawing.Color.Navy;
            this.txtthang.Location = new System.Drawing.Point(43, 9);
            this.txtthang.MaxLength = 2;
            this.txtthang.Name = "txtthang";
            this.txtthang.Size = new System.Drawing.Size(35, 22);
            this.txtthang.TabIndex = 0;
            this.txtthang.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtthang.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtthang_KeyPress);
            this.txtthang.Validated += new System.EventHandler(this.txtthang_Validated);
            this.txtthang.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtthang_KeyDown);
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label5.ForeColor = System.Drawing.Color.Navy;
            this.label5.Location = new System.Drawing.Point(82, 14);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(38, 13);
            this.label5.TabIndex = 37;
            this.label5.Text = " Năm :";
            this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // btnsua
            // 
            this.btnsua.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btnsua.ForeColor = System.Drawing.Color.Navy;
            this.btnsua.Image = global::Human.Properties.Resources.quick_edit;
            this.btnsua.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnsua.Location = new System.Drawing.Point(105, 12);
            this.btnsua.Name = "btnsua";
            this.btnsua.Size = new System.Drawing.Size(60, 28);
            this.btnsua.TabIndex = 5;
            this.btnsua.Text = "Sửa";
            this.btnsua.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.toolTip1.SetToolTip(this.btnsua, "Báo cáo");
            this.btnsua.UseVisualStyleBackColor = true;
            this.btnsua.Click += new System.EventHandler(this.btnsua_Click);
            // 
            // combodvi
            // 
            this.combodvi.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.combodvi.ForeColor = System.Drawing.Color.Navy;
            this.combodvi.ItemHeight = 14;
            this.combodvi.Location = new System.Drawing.Point(249, 10);
            this.combodvi.Name = "combodvi";
            this.combodvi.Size = new System.Drawing.Size(180, 22);
            this.combodvi.TabIndex = 2;
            this.combodvi.SelectedIndexChanged += new System.EventHandler(this.combodvi_SelectedIndexChanged);
            this.combodvi.KeyDown += new System.Windows.Forms.KeyEventHandler(this.combodvi_KeyDown);
            // 
            // cboLoainv
            // 
            this.cboLoainv.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboLoainv.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cboLoainv.ForeColor = System.Drawing.Color.Navy;
            this.cboLoainv.ItemHeight = 14;
            this.cboLoainv.Location = new System.Drawing.Point(489, 10);
            this.cboLoainv.Name = "cboLoainv";
            this.cboLoainv.Size = new System.Drawing.Size(156, 22);
            this.cboLoainv.TabIndex = 3;
            this.cboLoainv.SelectedIndexChanged += new System.EventHandler(this.cboLoainv_SelectedIndexChanged);
            this.cboLoainv.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cboloaihd_KeyDown);
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.ForeColor = System.Drawing.Color.Navy;
            this.label3.Location = new System.Drawing.Point(435, 14);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(48, 13);
            this.label3.TabIndex = 39;
            this.label3.Text = "Loại HĐ:";
            this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // groupBox1
            // 
            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox1.Controls.Add(this.chk_sudungdlcc);
            this.groupBox1.Controls.Add(this.dgrhienthi);
            this.groupBox1.Controls.Add(this.cboLoainv);
            this.groupBox1.Controls.Add(this.txtthang);
            this.groupBox1.Controls.Add(this.label5);
            this.groupBox1.Controls.Add(this.combodvi);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.txtnam);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Location = new System.Drawing.Point(3, -6);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(784, 531);
            this.groupBox1.TabIndex = 40;
            this.groupBox1.TabStop = false;
            // 
            // dgrhienthi
            // 
            this.dgrhienthi.AllowUserToAddRows = false;
            this.dgrhienthi.AllowUserToDeleteRows = false;
            this.dgrhienthi.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.dgrhienthi.BackgroundColor = System.Drawing.SystemColors.Window;
            this.dgrhienthi.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
            dataGridViewCellStyle1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dgrhienthi.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
            this.dgrhienthi.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgrhienthi.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Colhoten,
            this.Coltenbp,
            this.chucvu,
            this.Colhsluong,
            this.Colhschucvu,
            this.hs_kv,
            this.Colhstnhiem,
            this.Colhslnhiem,
            this.Coludnghe,
            this.Coludtien,
            this.Colvuotkhung,
            this.Colt_vkhung,
            this.Colngayngi,
            this.Colnstien,
            this.Coltiencong,
            this.Colbhxh,
            this.Colbhyt,
            this.Colbhtn,
            this.Colthuclanh,
            this.Colsotk,
            this.Colkpcd,
            this.Colchucvu,
            this.Colthoigian,
            this.Coltsan,
            this.Colom,
            this.Colghichu,
            this.Colkl,
            this.Colkhac,
            this.Colmangach,
            this.Colmanv,
            this.Colmadv,
            this.Colloaihd,
            this.Colmltt,
            this.chucdanhvt,
            this.Colthang,
            this.Colnam});
            dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle22.BackColor = System.Drawing.SystemColors.Window;
            dataGridViewCellStyle22.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle22.ForeColor = System.Drawing.SystemColors.ControlText;
            dataGridViewCellStyle22.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle22.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle22.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
            this.dgrhienthi.DefaultCellStyle = dataGridViewCellStyle22;
            this.dgrhienthi.Location = new System.Drawing.Point(6, 40);
            this.dgrhienthi.Margin = new System.Windows.Forms.Padding(0);
            this.dgrhienthi.Name = "dgrhienthi";
            this.dgrhienthi.ReadOnly = true;
            dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Control;
            dataGridViewCellStyle23.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dgrhienthi.RowHeadersDefaultCellStyle = dataGridViewCellStyle23;
            this.dgrhienthi.RowHeadersWidth = 20;
            this.dgrhienthi.Size = new System.Drawing.Size(778, 488);
            this.dgrhienthi.TabIndex = 20;
            this.dgrhienthi.CurrentCellChanged += new System.EventHandler(this.dgrhienthi_CurrentCellChanged);
            // 
            // Colhoten
            // 
            this.Colhoten.DataPropertyName = "hoten";
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Colhoten.DefaultCellStyle = dataGridViewCellStyle2;
            this.Colhoten.HeaderText = "Họ và Tên";
            this.Colhoten.Name = "Colhoten";
            this.Colhoten.ReadOnly = true;
            this.Colhoten.Width = 150;
            // 
            // Coltenbp
            // 
            this.Coltenbp.DataPropertyName = "tenbp";
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Coltenbp.DefaultCellStyle = dataGridViewCellStyle3;
            this.Coltenbp.HeaderText = "Bộ phận";
            this.Coltenbp.Name = "Coltenbp";
            this.Coltenbp.ReadOnly = true;
            // 
            // chucvu
            // 
            this.chucvu.DataPropertyName = "tencv";
            this.chucvu.HeaderText = "Chức vụ";
            this.chucvu.Name = "chucvu";
            this.chucvu.ReadOnly = true;
            this.chucvu.Visible = false;
            // 
            // Colhsluong
            // 
            this.Colhsluong.DataPropertyName = "hs_lc";
            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle4.Format = "N3";
            dataGridViewCellStyle4.NullValue = null;
            this.Colhsluong.DefaultCellStyle = dataGridViewCellStyle4;
            this.Colhsluong.HeaderText = "HS Lương";
            this.Colhsluong.Name = "Colhsluong";
            this.Colhsluong.ReadOnly = true;
            this.Colhsluong.Width = 50;
            // 
            // Colhschucvu
            // 
            this.Colhschucvu.DataPropertyName = "hs_cv";
            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colhschucvu.DefaultCellStyle = dataGridViewCellStyle5;
            this.Colhschucvu.HeaderText = "HS Chức vụ";
            this.Colhschucvu.Name = "Colhschucvu";
            this.Colhschucvu.ReadOnly = true;
            this.Colhschucvu.Width = 50;
            // 
            // hs_kv
            // 
            this.hs_kv.DataPropertyName = "hs_kv";
            this.hs_kv.HeaderText = "HS Khu vực";
            this.hs_kv.Name = "hs_kv";
            this.hs_kv.ReadOnly = true;
            this.hs_kv.Width = 50;
            // 
            // Colhstnhiem
            // 
            this.Colhstnhiem.DataPropertyName = "hs_tn";
            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colhstnhiem.DefaultCellStyle = dataGridViewCellStyle6;
            this.Colhstnhiem.HeaderText = "HS Trách nhiệm";
            this.Colhstnhiem.Name = "Colhstnhiem";
            this.Colhstnhiem.ReadOnly = true;
            this.Colhstnhiem.Width = 50;
            // 
            // Colhslnhiem
            // 
            this.Colhslnhiem.DataPropertyName = "hs_dh";
            dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colhslnhiem.DefaultCellStyle = dataGridViewCellStyle7;
            this.Colhslnhiem.HeaderText = "HS Độc hại";
            this.Colhslnhiem.Name = "Colhslnhiem";
            this.Colhslnhiem.ReadOnly = true;
            this.Colhslnhiem.Width = 50;
            // 
            // Coludnghe
            // 
            this.Coludnghe.DataPropertyName = "hs_ud";
            dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Coludnghe.DefaultCellStyle = dataGridViewCellStyle8;
            this.Coludnghe.HeaderText = "UĐ Nghề";
            this.Coludnghe.Name = "Coludnghe";
            this.Coludnghe.ReadOnly = true;
            this.Coludnghe.Width = 50;
            // 
            // Coludtien
            // 
            this.Coludtien.DataPropertyName = "t_udai";
            dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle9.Format = "N0";
            this.Coludtien.DefaultCellStyle = dataGridViewCellStyle9;
            this.Coludtien.HeaderText = "Số tiền";
            this.Coludtien.Name = "Coludtien";
            this.Coludtien.ReadOnly = true;
            // 
            // Colvuotkhung
            // 
            this.Colvuotkhung.DataPropertyName = "vk";
            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colvuotkhung.DefaultCellStyle = dataGridViewCellStyle10;
            this.Colvuotkhung.HeaderText = "Vượt khung";
            this.Colvuotkhung.Name = "Colvuotkhung";
            this.Colvuotkhung.ReadOnly = true;
            this.Colvuotkhung.Width = 50;
            // 
            // Colt_vkhung
            // 
            this.Colt_vkhung.DataPropertyName = "t_vk";
            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle11.Format = "N0";
            dataGridViewCellStyle11.NullValue = null;
            this.Colt_vkhung.DefaultCellStyle = dataGridViewCellStyle11;
            this.Colt_vkhung.HeaderText = "Số tiền";
            this.Colt_vkhung.Name = "Colt_vkhung";
            this.Colt_vkhung.ReadOnly = true;
            // 
            // Colngayngi
            // 
            this.Colngayngi.DataPropertyName = "nghi_tru";
            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle12.Format = "N0";
            this.Colngayngi.DefaultCellStyle = dataGridViewCellStyle12;
            this.Colngayngi.HeaderText = "Ngày nghỉ";
            this.Colngayngi.Name = "Colngayngi";
            this.Colngayngi.ReadOnly = true;
            this.Colngayngi.Width = 40;
            // 
            // Colnstien
            // 
            this.Colnstien.DataPropertyName = "t_nghitru";
            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle13.Format = "N0";
            dataGridViewCellStyle13.NullValue = null;
            this.Colnstien.DefaultCellStyle = dataGridViewCellStyle13;
            this.Colnstien.HeaderText = "Số tiền trừ";
            this.Colnstien.Name = "Colnstien";
            this.Colnstien.ReadOnly = true;
            // 
            // Coltiencong
            // 
            this.Coltiencong.DataPropertyName = "tongtien";
            dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle14.Format = "N0";
            dataGridViewCellStyle14.NullValue = null;
            this.Coltiencong.DefaultCellStyle = dataGridViewCellStyle14;
            this.Coltiencong.HeaderText = "Tiền công";
            this.Coltiencong.Name = "Coltiencong";
            this.Coltiencong.ReadOnly = true;
            // 
            // Colbhxh
            // 
            this.Colbhxh.DataPropertyName = "t_bhxh";
            dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle15.Format = "N0";
            dataGridViewCellStyle15.NullValue = null;
            this.Colbhxh.DefaultCellStyle = dataGridViewCellStyle15;
            this.Colbhxh.HeaderText = "BHXH";
            this.Colbhxh.Name = "Colbhxh";
            this.Colbhxh.ReadOnly = true;
            // 
            // Colbhyt
            // 
            this.Colbhyt.DataPropertyName = "t_bhyt";
            dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle16.Format = "N0";
            dataGridViewCellStyle16.NullValue = null;
            this.Colbhyt.DefaultCellStyle = dataGridViewCellStyle16;
            this.Colbhyt.HeaderText = "BHYT";
            this.Colbhyt.Name = "Colbhyt";
            this.Colbhyt.ReadOnly = true;
            // 
            // Colbhtn
            // 
            this.Colbhtn.DataPropertyName = "t_bhtn";
            dataGridViewCellStyle17.Format = "N0";
            dataGridViewCellStyle17.NullValue = null;
            this.Colbhtn.DefaultCellStyle = dataGridViewCellStyle17;
            this.Colbhtn.HeaderText = "BHTN";
            this.Colbhtn.Name = "Colbhtn";
            this.Colbhtn.ReadOnly = true;
            // 
            // Colthuclanh
            // 
            this.Colthuclanh.DataPropertyName = "thuclanh";
            dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle18.Format = "N0";
            dataGridViewCellStyle18.NullValue = null;
            this.Colthuclanh.DefaultCellStyle = dataGridViewCellStyle18;
            this.Colthuclanh.HeaderText = "Thực lãnh";
            this.Colthuclanh.Name = "Colthuclanh";
            this.Colthuclanh.ReadOnly = true;
            // 
            // Colsotk
            // 
            this.Colsotk.DataPropertyName = "sotk";
            this.Colsotk.HeaderText = "Số tài khoản";
            this.Colsotk.Name = "Colsotk";
            this.Colsotk.ReadOnly = true;
            // 
            // Colkpcd
            // 
            this.Colkpcd.DataPropertyName = "t_kpcd";
            this.Colkpcd.HeaderText = "Công đoàn";
            this.Colkpcd.Name = "Colkpcd";
            this.Colkpcd.ReadOnly = true;
            this.Colkpcd.Visible = false;
            // 
            // Colchucvu
            // 
            this.Colchucvu.DataPropertyName = "chucdanh";
            dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
            this.Colchucvu.DefaultCellStyle = dataGridViewCellStyle19;
            this.Colchucvu.HeaderText = "Chức vụ";
            this.Colchucvu.Name = "Colchucvu";
            this.Colchucvu.ReadOnly = true;
            // 
            // Colthoigian
            // 
            this.Colthoigian.DataPropertyName = "thoigian";
            dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle20.Format = "N0";
            dataGridViewCellStyle20.NullValue = null;
            this.Colthoigian.DefaultCellStyle = dataGridViewCellStyle20;
            this.Colthoigian.HeaderText = "Thu thêm BHYT";
            this.Colthoigian.Name = "Colthoigian";
            this.Colthoigian.ReadOnly = true;
            // 
            // Coltsan
            // 
            this.Coltsan.DataPropertyName = "nghi_ts";
            this.Coltsan.HeaderText = "Nghỉ TS";
            this.Coltsan.Name = "Coltsan";
            this.Coltsan.ReadOnly = true;
            this.Coltsan.Visible = false;
            // 
            // Colom
            // 
            this.Colom.DataPropertyName = "nghi_om";
            this.Colom.HeaderText = "Ốm";
            this.Colom.Name = "Colom";
            this.Colom.ReadOnly = true;
            this.Colom.Visible = false;
            // 
            // Colghichu
            // 
            this.Colghichu.DataPropertyName = "ghichu";
            this.Colghichu.HeaderText = "Ghi chú";
            this.Colghichu.Name = "Colghichu";
            this.Colghichu.ReadOnly = true;
            // 
            // Colkl
            // 
            this.Colkl.DataPropertyName = "nghi_kl";
            this.Colkl.HeaderText = "Không lương";
            this.Colkl.Name = "Colkl";
            this.Colkl.ReadOnly = true;
            this.Colkl.Visible = false;
            // 
            // Colkhac
            // 
            this.Colkhac.HeaderText = "Khác";
            this.Colkhac.Name = "Colkhac";
            this.Colkhac.ReadOnly = true;
            this.Colkhac.Visible = false;
            // 
            // Colmangach
            // 
            this.Colmangach.DataPropertyName = "mangach";
            dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colmangach.DefaultCellStyle = dataGridViewCellStyle21;
            this.Colmangach.HeaderText = "Mã ngạch";
            this.Colmangach.Name = "Colmangach";
            this.Colmangach.ReadOnly = true;
            // 
            // Colmanv
            // 
            this.Colmanv.DataPropertyName = "manv";
            this.Colmanv.HeaderText = "MaNV";
            this.Colmanv.Name = "Colmanv";
            this.Colmanv.ReadOnly = true;
            this.Colmanv.Visible = false;
            // 
            // Colmadv
            // 
            this.Colmadv.DataPropertyName = "madv";
            this.Colmadv.HeaderText = "Ma DV";
            this.Colmadv.Name = "Colmadv";
            this.Colmadv.ReadOnly = true;
            this.Colmadv.Visible = false;
            // 
            // Colloaihd
            // 
            this.Colloaihd.DataPropertyName = "loaihd";
            this.Colloaihd.HeaderText = "Loai HD";
            this.Colloaihd.Name = "Colloaihd";
            this.Colloaihd.ReadOnly = true;
            this.Colloaihd.Visible = false;
            // 
            // Colmltt
            // 
            this.Colmltt.DataPropertyName = "mltt";
            this.Colmltt.HeaderText = "Luong TT";
            this.Colmltt.Name = "Colmltt";
            this.Colmltt.ReadOnly = true;
            this.Colmltt.Visible = false;
            // 
            // chucdanhvt
            // 
            this.chucdanhvt.DataPropertyName = "chucdanhvt";
            this.chucdanhvt.HeaderText = "Viết tắt";
            this.chucdanhvt.Name = "chucdanhvt";
            this.chucdanhvt.ReadOnly = true;
            this.chucdanhvt.Visible = false;
            // 
            // Colthang
            // 
            this.Colthang.DataPropertyName = "thang";
            this.Colthang.HeaderText = "Tháng";
            this.Colthang.Name = "Colthang";
            this.Colthang.ReadOnly = true;
            this.Colthang.Visible = false;
            // 
            // Colnam
            // 
            this.Colnam.DataPropertyName = "nam";
            this.Colnam.HeaderText = "Năm";
            this.Colnam.Name = "Colnam";
            this.Colnam.ReadOnly = true;
            this.Colnam.Visible = false;
            // 
            // panelbottom
            // 
            this.panelbottom.Controls.Add(this.txtmanv);
            this.panelbottom.Controls.Add(this.txtsonv);
            this.panelbottom.Controls.Add(this.label7);
            this.panelbottom.Controls.Add(this.label8);
            this.panelbottom.Controls.Add(this.label6);
            this.panelbottom.Controls.Add(this.txtghichu);
            this.panelbottom.Controls.Add(this.txthoten);
            this.panelbottom.Controls.Add(this.btnluu);
            this.panelbottom.Controls.Add(this.btnsua);
            this.panelbottom.Controls.Add(this.btn_xem);
            this.panelbottom.Controls.Add(this.btnketthuc);
            this.panelbottom.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.panelbottom.Location = new System.Drawing.Point(0, 528);
            this.panelbottom.Name = "panelbottom";
            this.panelbottom.Size = new System.Drawing.Size(790, 44);
            this.panelbottom.TabIndex = 41;
            // 
            // txtmanv
            // 
            this.txtmanv.BackColor = System.Drawing.SystemColors.ControlLightLight;
            this.txtmanv.Location = new System.Drawing.Point(332, 18);
            this.txtmanv.Name = "txtmanv";
            this.txtmanv.ReadOnly = true;
            this.txtmanv.Size = new System.Drawing.Size(55, 21);
            this.txtmanv.TabIndex = 10;
            this.txtmanv.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            // 
            // txtsonv
            // 
            this.txtsonv.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.txtsonv.BackColor = System.Drawing.SystemColors.ControlLightLight;
            this.txtsonv.Location = new System.Drawing.Point(740, 18);
            this.txtsonv.Name = "txtsonv";
            this.txtsonv.ReadOnly = true;
            this.txtsonv.Size = new System.Drawing.Size(47, 21);
            this.txtsonv.TabIndex = 10;
            this.txtsonv.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.ForeColor = System.Drawing.Color.DarkBlue;
            this.label7.Location = new System.Drawing.Point(582, 4);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(42, 13);
            this.label7.TabIndex = 9;
            this.label7.Text = "Ghi chú";
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.ForeColor = System.Drawing.Color.DarkBlue;
            this.label8.Location = new System.Drawing.Point(332, 4);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(37, 13);
            this.label8.TabIndex = 9;
            this.label8.Text = "Mã NV";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.ForeColor = System.Drawing.Color.DarkBlue;
            this.label6.Location = new System.Drawing.Point(387, 4);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(56, 13);
            this.label6.TabIndex = 9;
            this.label6.Text = "Họ và Tên";
            // 
            // txtghichu
            // 
            this.txtghichu.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtghichu.Enabled = false;
            this.txtghichu.Location = new System.Drawing.Point(585, 18);
            this.txtghichu.Name = "txtghichu";
            this.txtghichu.Size = new System.Drawing.Size(149, 21);
            this.txtghichu.TabIndex = 8;
            // 
            // txthoten
            // 
            this.txthoten.Enabled = false;
            this.txthoten.Location = new System.Drawing.Point(388, 18);
            this.txthoten.Name = "txthoten";
            this.txthoten.Size = new System.Drawing.Size(195, 21);
            this.txthoten.TabIndex = 8;
            // 
            // btnluu
            // 
            this.btnluu.Enabled = false;
            this.btnluu.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btnluu.ForeColor = System.Drawing.Color.Navy;
            this.btnluu.Image = global::Human.Properties.Resources.save;
            this.btnluu.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnluu.Location = new System.Drawing.Point(168, 12);
            this.btnluu.Name = "btnluu";
            this.btnluu.Size = new System.Drawing.Size(60, 28);
            this.btnluu.TabIndex = 6;
            this.btnluu.Text = "&Lưu";
            this.btnluu.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.btnluu.UseVisualStyleBackColor = true;
            this.btnluu.Click += new System.EventHandler(this.btnluu_Click);
            // 
            // paneltop
            // 
            this.paneltop.Controls.Add(this.groupBox1);
            this.paneltop.Dock = System.Windows.Forms.DockStyle.Fill;
            this.paneltop.Location = new System.Drawing.Point(0, 0);
            this.paneltop.Name = "paneltop";
            this.paneltop.Size = new System.Drawing.Size(790, 528);
            this.paneltop.TabIndex = 42;
            // 
            // chk_sudungdlcc
            // 
            this.chk_sudungdlcc.Anchor = System.Windows.Forms.AnchorStyles.Top;
            this.chk_sudungdlcc.AutoSize = true;
            this.chk_sudungdlcc.Checked = true;
            this.chk_sudungdlcc.CheckState = System.Windows.Forms.CheckState.Checked;
            this.chk_sudungdlcc.ForeColor = System.Drawing.Color.DarkBlue;
            this.chk_sudungdlcc.Location = new System.Drawing.Point(654, 13);
            this.chk_sudungdlcc.Name = "chk_sudungdlcc";
            this.chk_sudungdlcc.Size = new System.Drawing.Size(155, 17);
            this.chk_sudungdlcc.TabIndex = 40;
            this.chk_sudungdlcc.Text = "Sử dụng dữ liệu chấm công";
            this.chk_sudungdlcc.UseVisualStyleBackColor = true;
            // 
            // frmbc_luong_BC
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
            this.ClientSize = new System.Drawing.Size(790, 572);
            this.ControlBox = false;
            this.Controls.Add(this.paneltop);
            this.Controls.Add(this.panelbottom);
            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "frmbc_luong_BC";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Bảng thanh toán tiền lương";
            this.Load += new System.EventHandler(this.frmbcttluong_Load);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgrhienthi)).EndInit();
            this.panelbottom.ResumeLayout(false);
            this.panelbottom.PerformLayout();
            this.paneltop.ResumeLayout(false);
            this.ResumeLayout(false);

		}

		#endregion
		
		private void frmbcttluong_Load(object sender, System.EventArgs e)
		{
			thang=txtthang.Text=DateTime.Now.Month.ToString().PadLeft(2,'0');
			nam=txtnam.Text=DateTime.Now.Year.ToString();	
			s_mmyy =thang+nam.Substring(2,2);
			Load_bophan();
            loadhopdong();
            this.WindowState = FormWindowState.Maximized;
            txtthang.Focus();
  		}       

        private void loadhopdong()
        {
            ds = mDB.get_nhombc();
            cboLoainv.DisplayMember = "tennhom";
            cboLoainv.ValueMember = "manhom";
            cboLoainv.DataSource = ds.Tables[0];
        }

		private void Load_bophan()
		{
            ds = mDB.get_bophan();
			combodvi.DataSource=ds.Tables[0];
			combodvi.DisplayMember="tenbp";
			combodvi.ValueMember="madv";
			combodvi.SelectedIndex=-1;
		}

		private void print()
		{
            int nn = 0, tt = 0;
            string sql = "", ud_nghe = "", t_ud = "", nghi_tru = "",t_nghitru="",tong_tien="";

            s_mmyy = txtthang.Text.PadLeft(2,'0') + txtnam.Text.Trim().Substring(2, 2);
            thang = txtthang.Text.Trim().PadLeft(2, '0');
            nam = txtnam.Text.Trim();
            if (!mDB.kt_thangnam(thang,nam)) return;
            if (!mDB.bMmyy(s_mmyy))
            {
                MessageBox.Show(lan.Change_language_MessageText("Số liệu chưa tạo !"),lan.Change_language_MessageText( "Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (!mDB.kt_heso(s_mmyy))
            {
                MessageBox.Show(lan.Change_language_MessageText("Chưa cập nhật hệ số !"),lan.Change_language_MessageText( "Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try	{
                int n = Convert.ToInt32(nam), t = Convert.ToInt32(thang);
                nn = Convert.ToInt32(txtnam.Text.Trim());
                tt = Convert.ToInt32(txtthang.Text.Trim());

                if (t >1)
                    t--;
                else
                {
                    t = 12;
                    n--;
                }                
                ud_nghe = "case when b.hs_th>0 then round(b.hs_th/(b.hs_lc+(b.hs_lc*b.vk)+b.hs_cv)*100,1) else 0 end";
                t_ud = "round(case when b.bdhv>0 then p.ngaybdhv*b.bdhv else ((b.mltt/" + DateTime.DaysInMonth(nn, tt) + ")*((1+case when b.vk>0 then b.vk else 0 end)*b.hs_lc + case when b.hs_cv>0 then b.hs_cv else 0 end)/100)*";
                t_ud += "(" + ud_nghe + "*(" + DateTime.DaysInMonth(nn, tt) + "-case when d.songay>0 then d.songay else 0 end -case when d.songay1>0 then d.songay1 else 0 end)";
                t_ud += "+ case when d.songay>0 then d.songay*d.hs_ud_tc else 0 end + case when songay1>0 then hs_ud_moi1*songay1 else 0 end) end,2)";
                nghi_tru = "(nghi_om+nghi_ts+nghi_kl+nghi_co+nghi_kp+nghi_tn+nghi_kt+nghi_sc+nghi_khac)";
                t_nghitru = "round(case when " + nghi_tru + ">0 then " + nghi_tru + " else 0 end *((1+b.vk)*b.hs_lc + b.hs_cv)*b.mltt/26,2) ";
                tong_tien = " case when a.loaihd='H4' then round(b.luonghd,0) else (b.hs_lc*(1+b.vk)+b.hs_cv+b.hs_tn+b.hs_dh+b.hs_kv +(b.hs_lc*b.vk +b.hs_cv+b.hs_lc)*b.hs_ud/100)*b.mltt+" + t_ud+" end ";

                sql = "select a.ho||' '||a.ten as hoten,bophan.tenbp,'"+txtthang.Text.Trim()+"' as thang,'"+txtnam.Text+"' as nam,";
                sql += "case when trim(dmcv.tenvt)<>'' then dmcv.tenvt else dmcv.diengiai end as tencv,cd.ten as chucdanh,b.mltt,e.ma1 as mangach,b.hs_lc,";
                sql += " case when mahd.nhombc= 4 then round(b.luonghd,0) else round(b.hs_lc*b.mltt,0) end as luongchinh,";
                sql += " case when b.vk>0 then Replace(to_char(b.vk*100,'9999S')||'%','+','') end as vk,";

                sql += "cd.tenvt as chucdanhvt,";
                sql += "case when b.vk>0 then round(b.hs_lc*vk*b.mltt,2) end as t_vk";
                sql += " ,case when b.hs_cv>0 then b.hs_cv else 0 end as hs_cv,case when b.hs_cv>0 then round(b.hs_cv*b.mltt,2) else 0 end as t_cv";
                sql += " ,case when b.hs_tn>0 then b.hs_tn else 0 end as hs_tn,case when b.hs_tn>0 then round(b.hs_tn*b.mltt,2) else 0 end as t_tn";
                sql += " ,case when b.hs_kv>0 then b.hs_kv else 0 end as hs_kv,case when b.hs_kv>0 then round(b.hs_kv*b.mltt,2) else 0 end as t_kv";
                sql += " ,case when b.hs_ud>0 then b.hs_ud else 0 end as hs_ud,case when b.hs_ud>0 then round((b.hs_lc*b.vk +b.hs_cv+b.hs_lc)*b.mltt*b.hs_ud/100,2) else 0 end as t_pcud";
                sql += " ,case when b.hs_dh>0 then b.hs_dh else 0 end as hs_dh,case when b.hs_dh>0 then round(b.hs_dh*b.mltt,2) else 0 end as t_dh";
                sql += ",case when " + ud_nghe + ">0 then Replace(to_char(" + ud_nghe + ",'9999S')||'%','+','') else case when b.bdhv>0 then Replace(to_char(p.ngaybdhv,'9999S')||' Ngày','+','') else '' end end as ud_nghe,";
                sql += t_ud + " as t_udai,case when " + nghi_tru + " >0 then " + nghi_tru + " end as nghi_tru,";
                sql += t_nghitru + " as t_nghitru,round(" + tong_tien + ",2) as tongtien,b.t_bhxh,b.t_bhtn,b.t_bhyt*(1+case when dll.thoigian > 0 then dll.thoigian else 0 end) as t_bhyt,";
                sql += " round(" + tong_tien + "-b.t_bhyt-b.t_bhxh-b.t_bhtn-" + t_nghitru + ") as thuclanh,nghi_om,nghi_sc as nghi_ts ,";
                sql += "nghi_kl,b.t_kpcd,dll.thoigian,case when trim(tn.ghichu)='' then gc.ghichu else tn.ghichu end as ghichu,a.manv,a.madv,h.loaihd,ll.sotk ";
                sql += " from " + mDB.user_payroll + ".nv_" + s_mmyy + " a";
                sql += " left join " + mDB.user + ".dmcv on a.macv=dmcv.macv ";
                sql += " left join " + mDB.user + ".dmcd cd on a.macd=cd.ma ";
                sql += " left join " + mDB.user + ".mahd on a.loaihd=mahd.mahd ";
                sql += " join " + mDB.user_payroll + ".bcc_" + s_mmyy + " b on a.manv=b.manv ";
                sql += " left join " + mDB.user_payroll + ".nn_" + s_mmyy + " c on b.manv=c.manv ";
                sql += " join " + mDB.user + ".bophan on a.madv=bophan.madv";
                sql += " join " + mDB.user + ".hopdong h on h.manv=a.manv and h.ngaydenct=a.ngaydenct ";
                sql += " join " + mDB.user + ".mangach e on h.mangach=e.ma ";
                sql += " left join "+ mDB.user_payroll + ".dll on a.manv=dll.manv and dll.mmyy=a.mmyy ";
                sql += " left join " + mDB.user + ".nv_tangcuong_" + s_mmyy + " d on d.manv=a.manv";
                sql += " join "+ mDB.user_payroll + ".pc_"+s_mmyy+" p on p.manv=h.manv ";
                sql += " join " + mDB.user_payroll + ".heso f on f.mm='" + thang + "' and f.yyyy='" + nam + "'";
                sql += " left join " + mDB.user + ".ghichu gc on gc.magc=h.magc";
                sql += " left join " + mDB.user_payroll + ".thunhap_" + s_mmyy + " tn on a.manv=tn.manv ";
                sql += " inner join " + mDB.user + ".llnv ll on ll.manv=h.manv ";
                if (combodvi.SelectedIndex != -1)
                    sql += " where a.madv='" + combodvi.SelectedValue.ToString() + "'";
                if (cboLoainv.SelectedIndex != -1)
                {
                    if (combodvi.SelectedIndex != -1)
                        sql += " and ";
                    else
                        sql += " where ";
                        sql += " a.loaihd in (" + cboLoainv.SelectedValue.ToString() + ")";
                }
                sql += " order by bophan.sothutu,cd.thutu,dmcv.stt,e.ma1";                
                ds = mDB.get_data(sql);
                dgrhienthi.DataSource = ds.Tables[0];
                txtsonv.Text = ds.Tables[0].Rows.Count.ToString();
			}
			catch(Exception ex)	
			{
				MessageBox.Show(ex.ToString());
			}		
		}

		private void xem_Click(object sender, System.EventArgs e)
		{
            if (ds != null)
            {
                ds.WriteXml("xml\\bc_luongthang.xml",XmlWriteMode.WriteSchema);
                ReportName = "BcLuong_ls.rpt";

                DataRow[] r = dsHd.Tables[0].Select("ten='" + cboLoainv.Text + "'");
                if (r.Length > 0)
                {
                    string nhom=r[0]["nhom"].ToString();
                    DataRow[] dr = dmbc.Tables[0].Select("manhom='" + nhom + "'");
                    if (dr.Length > 0)
                    {
                        _title = dr[0]["title"].ToString();
                        msg = dr[0]["title1"].ToString();
                    }
                }
                //mDB.UpdateThunhap(ds, s_mmyy);
                frmReport f = new frmReport(mDB, ds, ReportName, msg, _title);
                //switch (checkxem.Checked)
                //{ 
                //    case false:
                //        f.PreviewReport();
                //        f.butIn_Click(null,null);
                //        break;
                //    case true:
                //        f.ShowDialog();
                //        break;
                //}
            }
            else
                MessageBox.Show(lan.Change_language_MessageText("Không có dữ liệu !"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
		}

        #region Các sự kiện của control

        private void txtnam_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
			{
				combodvi.SelectedIndex=-1;
				SendKeys.Send("{tab}{F4}");
			}
		}

		private void cboloaihd_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
            if (e.KeyCode == Keys.Enter)
            {
                SendKeys.Send("{Tab}");
            }
		}	

		private void combodvi_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
            if (e.KeyCode == Keys.Enter)
            {
                if (combodvi.Text.Trim().Equals(""))
                    print();
                SendKeys.Send("{Tab}");
            }
		}	

        private void buttonkethuc_Click(object sender, System.EventArgs e)
        {
            this.Close();
        }

		private void txtthang_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

        private void txtthang_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b')
                e.KeyChar = '\0';
        }
        #endregion

        private void btnluu_Click(object sender, EventArgs e)
        {
            if (udate_ghichu())
            {
                setControl(false, "Sửa");
                DataRow[] dr = ds.Tables[0].Select("manv='" + txtmanv.Text + "'");
                if (dr.Length > 0)
                    dr[0]["ghichu"] = txtghichu.Text;
            }
            else
            {
                MessageBox.Show(lan.Change_language_MessageText("Không lưu được ghi chú !!!"));
                txtghichu.Focus();
            }

        }

        private void btnsua_Click(object sender, EventArgs e)
        {
            if (btnsua.Text.Equals(lan.Change_language_MessageText("Sửa")))
            {
                setControl(true, lan.Change_language_MessageText("Hủy"));
                txtghichu.Focus();
            }
            else
            {
                setControl(false, lan.Change_language_MessageText("Sửa"));
            }
        }

        public void setControl(bool var, string Name)
        {
            btnsua.Text = Name;
            btnluu.Enabled = var;
            txtghichu.Enabled = var;
            btn_xem.Enabled = !var;
            btnketthuc.Enabled = !var;
            
        }

        private void combodvi_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.ActiveControl == combodvi)
            {
                print();
            }
        }

        private void cboLoainv_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.ActiveControl == cboLoainv)
            {
                print();
            }
        }

        private void dgrhienthi_CurrentCellChanged(object sender, EventArgs e)
        {
            try
            {
                DataRowView dr = (DataRowView)(dgrhienthi.CurrentRow.DataBoundItem);
                txtmanv.Text = dr["manv"].ToString();
                txthoten.Text = dr["hoten"].ToString();
                txtghichu.Text = dr["ghichu"].ToString();
            }
            catch
            { }
        }

        public bool udate_ghichu()
        {
            string sql = "update luong.thunhap_" + s_mmyy + " set ghichu='" + txtghichu.Text + "' ";
            sql += "where manv='" + txtmanv.Text + "'";
            return mDB.Execute_data(sql);
        }

        private void txtthang_Validated(object sender, EventArgs e)
        {
            thang = txtthang.Text.Trim().PadLeft(2,'0');
        }
    }
}
